package com.hlkj.pay.infrastructure.model.merchant;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hlkj.framework.common.util.collection.CollectionUtils;
import com.hlkj.framework.common.util.json.JsonUtils;
import com.hlkj.framework.mybatis.core.dataobject.BaseDO;

import com.hlkj.pay.dto.merchant.MerchantAccessScene;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;

import java.util.List;

/**
* 汇电通电商平台经营信息表
* @TableName t_merchant_report_business
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("t_merchant_report_business")
public class MerchantReportBusinessDO extends BaseDO {


    /**
    * 报备id
    */
    @Schema(description = "报备id")
    private Long reportId;
    /**
    * 商户商户号
    */
    @Schema(description = "商户商户号")
    private String sn;
    /**
    * 商户简称
    */
    @Schema(description = "商户简称")
    private String shortName;
    /**
    * 业务类型 1：实体，2：虚拟 
    */
    @Schema(description = "业务类型")
    private Integer businessType;
    /**
    * 电商平台店铺id
    */
    @Schema(description = "电商平台店铺id")
    private String shopId;
    /**
    * 电商平台店铺名称
    */
    @Schema(description = "电商平台店铺名称")
    private String shopName;
    /**
    * 省份编码
    */
    @Schema(description = "省份编码")
    private String provinceCode;
    /**
    * 城市编码
    */
    @Schema(description = "城市编码")
    private String cityCode;
    /**
    * 区域编码
    */
    @Schema(description = "区域编码")
    private String areaCode;
    /**
    * 地址
    */
    @Schema(description = "地址")
    private String address;
    /**
    * 备注
    */
    @Schema(description = "备注")
    private String remark;


    /**
     * 门店门头url
     */
    @Schema(description = "门店门头url")
    private String storeHeaderUrl;

    /**
     * 店铺内景url
     */
    @Schema(description = "门店门头url")
    private String storeIndoorUrl;

    /**
     * 店铺收银台 前台url
     */
    @Schema(description = "门店门头url")
    private String storeCashierDeskUrl;
    /**
     * 经营Scene
     */
    private String sceneJson;
    /**
     * MCC编码
     */
    @Schema(description = "MCC编码 字典接口通过 dictKey=mccCategory 获取一级 然后通过 dictKey=mccCategory,parentDictKey=一级code 获取 ")
    private String mcc;
    /**
     * 企业经济性质
     */
    @Schema(description = "企业经济性质 字典接口通过 dictKey=economyType 获取")
    private String economyType;
    /**
     * 企业规模
     */
    @Schema(description = "企业规模 字典接口通过 dictKey=companySizeType 获取")
    private String companySizeType;
    /**
     * 企业规模
     */
    @Schema(description = "上市类型 字典接口通过 dictKey=listingType 获取")
    private String listingType;
    /**
     * 其他附件
     */
    private String fileUrlJson;
    /**
     * 其他附件
     */
    private String otherDataJson;
    /**
     * 经营资质
     */
    @TableField(exist = false)
    @Schema(description = "经营资质")
    private List<MerchantAccessScene> sceneList;

    /**
     * 其他附件
     */
    @TableField(exist = false)
    private List<String> fileUrls;
    public List<MerchantAccessScene> getSceneList() {
        if (!CollectionUtils.isEmpty(this.sceneList)) {
            return this.sceneList;
        }
        if (StringUtils.hasText(sceneJson)) {
            setSceneList(JsonUtils.parseArray(sceneJson, MerchantAccessScene.class));
        }
        return this.sceneList;
    }
    public List<String> getFileUrls() {
        if (!CollectionUtils.isEmpty(this.fileUrls)) {
            return this.fileUrls;
        }
        if (StringUtils.hasText(fileUrlJson)) {
            setFileUrls(JsonUtils.parseArray(fileUrlJson, String.class));
        }
        return this.fileUrls;
    }

}
